package com.duan.service;

import com.duan.mapper.SettingMapper;
import com.duan.pojo.Setting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SettingService {
    private final SettingMapper settingMapper;

    @Autowired
    public SettingService(SettingMapper settingMapper){
        this.settingMapper = settingMapper;
    }

    /***
     * 通过session中保存的userid信息来获取此用户设置的此次抽奖活动信息
     * @param userId 用户Id
     * @return 封装好的Setting对象（包含表中的所有setting字段属性）
     */
    public Setting queryByUserId(Integer userId){
        return settingMapper.selectByUserId(userId);
    }

    public int update(Integer batchNumber, Integer userId){
        return this.settingMapper.update(batchNumber, userId);
    }
}
